home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Misc Servers / Zope.exe / DTML-SQLTEST.STX < prev    next >
Encoding:
Text File  |  2000-10-12  |  2.2 KB  |  82 lines

  1. sqltest: Formats SQL condition tests
  2.  
  3.     The 'sqltest' tag inserts a condition test into SQL code. It tests
  4.     a column against a variable. This tag is used in SQL Methods.
  5.  
  6.   Syntax
  7.  
  8.     'sqltest' tag syntax::
  9.  
  10.       <dtml-sqltest Variable|expr="VariableExpression">
  11.  
  12.     The 'sqltest' tag is a singleton. It inserts a SQL condition test
  13.     statement. It is used to build SQL queries. The 'sqltest' tag
  14.     correctly escapes the inserted variable. The named variable or
  15.     variable expression is tested against a SQL column using the
  16.     specified comparison operation.
  17.  
  18.   Attributes
  19.  
  20.     type=string -- The type of the variable. Valid types include:
  21.     'string', 'int', 'float' and 'nb'. 'nb' means non-blank
  22.     string. The type attribute is required and is used to properly
  23.     escape inserted variable.
  24.  
  25.     column=string -- The name of the SQL column to test against. This
  26.     attribute defaults to the variable name.
  27.  
  28.     multiple=boolean -- If true, then the variable may be a sequence
  29.     of values to test the column against.
  30.  
  31.     optional=boolean -- If true, then the test is optional and will
  32.     not be rendered if the variable is empty or non-existent.
  33.  
  34.     op=string -- The comparison operation. Valid comparisons include: 
  35.  
  36.       eq -- equal to
  37.       
  38.       gt -- greater than
  39.  
  40.       lt -- less than
  41.  
  42.       ne -- not equal to
  43.  
  44.       ge -- greater than or equal to
  45.  
  46.       le -- less than or equal to
  47.  
  48.       The comparison defaults to equal to. If the comparison is not
  49.       recognized it is used anyway. Thus you can use comparisons such
  50.       as 'like'.
  51.  
  52.   Examples
  53.  
  54.     Basic usage::
  55.  
  56.       select * from employees
  57.         where <dtml-sqltest name type="string">
  58.  
  59.     If the 'name' variable is 'Bob' then this renders::
  60.  
  61.       select * from employees
  62.         where name = 'Bob'
  63.      
  64.     Multiple values::
  65.  
  66.       select * from employees
  67.         where <dtml-sqltest empid type=int multiple>
  68.     
  69.     If the 'empid' variable is '(12,14,17)' then this renders::
  70.  
  71.       select * from employees
  72.         where empid in (12, 14, 17)
  73.  
  74.   See Also
  75.  
  76.     "sqlgroup tag":dtml-sqlgroup.stx
  77.  
  78.     "sqlvar tag":dtml-sqlvar.stx
  79.  
  80.  
  81.  
  82.